package com.sunfeng.chap2.p13;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;

/**
 * @Author : 孙峰
 * @Description:
 * @Date : 2021/10/9  16:55
 */
public class Test13_14 {
    public static void main(String[] args) throws IOException {
        RandomAccessFile randomAccessFile = new RandomAccessFile("d:\\nio\\d.txt", "rw");
        FileChannel fileChannel = randomAccessFile.getChannel();
        fileChannel.write(ByteBuffer.wrap("qazwsx".getBytes()));
    }
}
